#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

icon01 = $(CURDIR)/cs2d.png
archive01 = $(CURDIR)/CounterStrike2D
archive02 = $(CURDIR)/cs2d_dedicated
launcher01 = $(CURDIR)/cs2d.desktop
script01 = $(CURDIR)/cs2d

DEST01 = $(CURDIR)/debian/cs2d/usr/local/games
DEST02 = $(CURDIR)/debian/cs2d/usr/local/games/cs2d
DEST03 = $(CURDIR)/debian/cs2d/usr/share/applications
DEST04 = $(CURDIR)/debian/cs2d/usr/share/pixmaps
DEST05 = $(CURDIR)/debian/cs2d/usr/bin

build: build-stamp
build-stamp:
	dh_testdir
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	dh_clean

install: build clean $(icon01) $(launcher01) $(archive01) $(archive02) $(script01)
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	dh_install
	
	mkdir -m 777 -p $(DEST01)
	mkdir -m 777 -p $(DEST02)
	mkdir -m 755 -p $(DEST03)
	mkdir -m 755 -p $(DEST04)
	mkdir -m 755 -p $(DEST05)
	
	cp -r bots $(CURDIR)/debian/cs2d/usr/local/games/cs2d
	cp -r gfx $(CURDIR)/debian/cs2d/usr/local/games/cs2d
	cp -r help $(CURDIR)/debian/cs2d/usr/local/games/cs2d
	cp -r logos $(CURDIR)/debian/cs2d/usr/local/games/cs2d
	cp -r maps $(CURDIR)/debian/cs2d/usr/local/games/cs2d
	cp -r sfx $(CURDIR)/debian/cs2d/usr/local/games/cs2d
	cp -r sys $(CURDIR)/debian/cs2d/usr/local/games/cs2d
	cp -r screens $(CURDIR)/debian/cs2d/usr/local/games/cs2d
	
	install -m 777 $(icon01) $(DEST02)
	install -m 777 $(icon01) $(DEST04)
	install -m 755 $(launcher01) $(DEST03)
	install -m 777 $(archive01) $(DEST02)
	install -m 777 $(archive02) $(DEST02)
	install -m 777 $(script01) $(DEST05)
	
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installman
	dh_link
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
